.class Lcom/baidu/aw;
.super Landroid/widget/TextView;


# instance fields
.field private a:F

.field private b:F

.field private c:F

.field private d:Z

.field private e:Landroid/graphics/Paint;

.field private f:Ljava/lang/String;

.field private g:F

.field private final h:F


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1

    invoke-direct {p0, p1}, Landroid/widget/TextView;-><init>(Landroid/content/Context;)V

    const-string v0, ""

    iput-object v0, p0, Lcom/baidu/aw;->f:Ljava/lang/String;

    const/high16 v0, 0x4248

    iput v0, p0, Lcom/baidu/aw;->g:F

    const/high16 v0, 0x3f80

    iput v0, p0, Lcom/baidu/aw;->h:F

    return-void
.end method

.method private b()V
    .locals 1

    iget v0, p0, Lcom/baidu/aw;->g:F

    iput v0, p0, Lcom/baidu/aw;->b:F

    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/baidu/aw;->d:Z

    return-void
.end method

.method private c()V
    .locals 1

    const/4 v0, 0x0

    iput v0, p0, Lcom/baidu/aw;->b:F

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/baidu/aw;->d:Z

    return-void
.end method


# virtual methods
.method public a()V
    .locals 2

    invoke-virtual {p0}, Lcom/baidu/aw;->getPaint()Landroid/text/TextPaint;

    move-result-object v0

    iget-object v1, p0, Lcom/baidu/aw;->f:Ljava/lang/String;

    invoke-virtual {v0, v1}, Landroid/text/TextPaint;->measureText(Ljava/lang/String;)F

    move-result v0

    iput v0, p0, Lcom/baidu/aw;->a:F

    invoke-virtual {p0}, Lcom/baidu/aw;->getWidth()I

    move-result v0

    div-int/lit8 v0, v0, 0x4

    int-to-float v0, v0

    iput v0, p0, Lcom/baidu/aw;->g:F

    iget v0, p0, Lcom/baidu/aw;->g:F

    const/4 v1, 0x0

    cmpl-float v0, v0, v1

    if-nez v0, :cond_0

    const/high16 v0, 0x4248

    iput v0, p0, Lcom/baidu/aw;->g:F

    :cond_0
    invoke-virtual {p0}, Lcom/baidu/aw;->getTextSize()F

    move-result v0

    invoke-virtual {p0}, Lcom/baidu/aw;->getPaddingTop()I

    move-result v1

    int-to-float v1, v1

    add-float/2addr v0, v1

    iput v0, p0, Lcom/baidu/aw;->c:F

    invoke-direct {p0}, Lcom/baidu/aw;->c()V

    invoke-virtual {p0}, Lcom/baidu/aw;->getWidth()I

    move-result v0

    if-lez v0, :cond_1

    iget v0, p0, Lcom/baidu/aw;->a:F

    invoke-virtual {p0}, Lcom/baidu/aw;->getWidth()I

    move-result v1

    int-to-float v1, v1

    cmpl-float v0, v0, v1

    if-lez v0, :cond_1

    invoke-direct {p0}, Lcom/baidu/aw;->b()V

    :cond_1
    return-void
.end method

.method public a(Ljava/lang/String;)V
    .locals 0

    iput-object p1, p0, Lcom/baidu/aw;->f:Ljava/lang/String;

    return-void
.end method

.method protected onDraw(Landroid/graphics/Canvas;)V
    .locals 4

    :try_start_0
    iget-object v0, p0, Lcom/baidu/aw;->f:Ljava/lang/String;

    iget v1, p0, Lcom/baidu/aw;->b:F

    iget v2, p0, Lcom/baidu/aw;->c:F

    iget-object v3, p0, Lcom/baidu/aw;->e:Landroid/graphics/Paint;

    invoke-virtual {p1, v0, v1, v2, v3}, Landroid/graphics/Canvas;->drawText(Ljava/lang/String;FFLandroid/graphics/Paint;)V

    iget-boolean v0, p0, Lcom/baidu/aw;->d:Z

    if-nez v0, :cond_0

    :goto_0
    return-void

    :cond_0
    iget v0, p0, Lcom/baidu/aw;->b:F

    const/high16 v1, 0x3f80

    sub-float/2addr v0, v1

    iput v0, p0, Lcom/baidu/aw;->b:F

    iget v0, p0, Lcom/baidu/aw;->a:F

    invoke-virtual {p0}, Lcom/baidu/aw;->getWidth()I

    move-result v1

    mul-int/lit8 v1, v1, 0x3

    div-int/lit8 v1, v1, 0x4

    int-to-float v1, v1

    sub-float/2addr v0, v1

    float-to-int v0, v0

    iget v1, p0, Lcom/baidu/aw;->b:F

    neg-int v0, v0

    int-to-float v0, v0

    cmpg-float v0, v1, v0

    if-gez v0, :cond_1

    iget v0, p0, Lcom/baidu/aw;->g:F

    iput v0, p0, Lcom/baidu/aw;->b:F

    :cond_1
    const-wide/16 v0, 0x23

    invoke-virtual {p0, v0, v1}, Lcom/baidu/aw;->postInvalidateDelayed(J)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    const-string v1, "AutoScrollTextView.onDraw"

    invoke-static {v1, v0}, Lcom/baidu/bk;->a(Ljava/lang/String;Ljava/lang/Throwable;)I

    goto :goto_0
.end method

.method protected onSizeChanged(IIII)V
    .locals 0

    invoke-super {p0, p1, p2, p3, p4}, Landroid/widget/TextView;->onSizeChanged(IIII)V

    invoke-virtual {p0}, Lcom/baidu/aw;->a()V

    return-void
.end method

.method public setTextColor(I)V
    .locals 1

    invoke-super {p0, p1}, Landroid/widget/TextView;->setTextColor(I)V

    invoke-virtual {p0}, Lcom/baidu/aw;->getPaint()Landroid/text/TextPaint;

    move-result-object v0

    iput-object v0, p0, Lcom/baidu/aw;->e:Landroid/graphics/Paint;

    iget-object v0, p0, Lcom/baidu/aw;->e:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setColor(I)V

    return-void
.end method

.method public setTextSize(F)V
    .locals 1

    invoke-super {p0, p1}, Landroid/widget/TextView;->setTextSize(F)V

    invoke-virtual {p0}, Lcom/baidu/aw;->getPaint()Landroid/text/TextPaint;

    move-result-object v0

    iput-object v0, p0, Lcom/baidu/aw;->e:Landroid/graphics/Paint;

    iget-object v0, p0, Lcom/baidu/aw;->e:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setTextSize(F)V

    return-void
.end method

.method public setTypeface(Landroid/graphics/Typeface;)V
    .locals 1

    invoke-super {p0, p1}, Landroid/widget/TextView;->setTypeface(Landroid/graphics/Typeface;)V

    invoke-virtual {p0}, Lcom/baidu/aw;->getPaint()Landroid/text/TextPaint;

    move-result-object v0

    iput-object v0, p0, Lcom/baidu/aw;->e:Landroid/graphics/Paint;

    iget-object v0, p0, Lcom/baidu/aw;->e:Landroid/graphics/Paint;

    invoke-virtual {v0, p1}, Landroid/graphics/Paint;->setTypeface(Landroid/graphics/Typeface;)Landroid/graphics/Typeface;

    return-void
.end method
